/**
 * 
 * Simple loading for sound files
 * Uses Slick Utilities library, which
 * runs well with lwjgl.
 * Slick util uses OpenAL.
 * 
 * 
 * @author Andrew
 * @creator Andrew
 * 
 */


import org.newdawn.slick.openal.Audio;
import org.newdawn.slick.openal.AudioLoader;
import org.newdawn.slick.util.ResourceLoader;


public class Sound {
	
	private Audio effect;
	
	public Sound(String input) {
		try {
			// load it from the data folder
		  this.effect = AudioLoader.getAudio("OGG", ResourceLoader.getResourceAsStream("data/" + input));
		} catch (Exception e) {  // error handling
			e.printStackTrace();
			System.exit(-1);
		}
	      
	}
	// play as sound effect
	public void play() {
		// numbers are for pitch and volume I think, but either way it only really works at 1,1
		this.effect.playAsSoundEffect(1.0f, 1.0f, false);
	}
	
	// Play as music, looping it
	public void playMusic() {
		this.effect.playAsMusic(1.0f, 1.0f, true);
	}
	
	

}
